package com.richrail.console.commands;

import com.richrail.model.entities.DepotStorage;

public class DeleteCommand
{
	private DepotStorage depotStorage;
	
	public void setDepotStorage(DepotStorage depotStorage)
	{
		this.depotStorage = depotStorage;
	}
	
	public String execute(String type, String name)
	{
		String response;
		
		if (type.equals("train"))
		{
			response = depotStorage.removeTrain(name)
				? "train " + name + " deleted"
				: "train " + name + " does not exists";
		}
		else
		{
			response = depotStorage.removeWagon(name)
				? "wagon " + name + " deleted"
				: "wagon " + name + " does not exists";
		}
		
		return response;
	}
}
